/**
 *
 */
package steven.common.android;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.app.Service;
import android.content.Context;

/**
 * @author steven.lam.t.f
 *
 */
public class AndroidUtils{
	protected AndroidUtils(){
	}
	public static final boolean isServiceRunning(final Context context, final Class<? extends Service> clazz){
		final ActivityManager am = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
		for(final RunningServiceInfo service : am.getRunningServices(Integer.MAX_VALUE)){
			if(clazz.getName().equals(service.service.getClassName())){
				return true;
			}
		}
		return false;
	}
}
